package com.test.springboot_test.stringTest;

public class StringTest4 {

    public static void main(String[] args) {

        /**
         * 字符串的基本操作
         * 1.字符串的截取
         * 2.字符串的拼接
         * 3.字符串的索引，匹配从前往后
         * 4.字符串的索引，匹配从后往前
         * 5.字母从大到小，字符串切换
         * 6.字母从小到大，字符串切换
         */

        //1.字符串的截取      2.字符串的索引，匹配从后往前
        String str = "1+1=@2";
        System.out.println(str.substring(0,str.lastIndexOf("@")));
        System.out.println(str.substring(str.lastIndexOf("@") + 1));
        //3.字符串的拼接
        String str1[] = {"a","b","c"};
        StringBuilder builder = new StringBuilder();
        for(String a : str1){
            builder.append(a);
        }
        System.out.println(builder.toString());
        //4.字母从大到小，字符串切换
        String str2 = "abcdefg";
        System.out.println(str2.toUpperCase());
        //5.字母从大到小，字符串切换
        String str3 = "ABCDEFG";
        System.out.println(str3.toLowerCase());

    }

}
